<?php require_once 'header.php';
require_once 'OwnerPage.php';
require_once 'backend/Owner.php';

$owner = unserialize($_SESSION['owner']);
?>
	<fieldset>
	  <legend>Assign Orders To Employee</legend>
	  <br>
	  <form method = 'post'>
	  <?php 
	  	echo $owner-> ViewUnassignOrder();
	  	
	  	if(isset($_POST['ViewOrder']))
	  	{
	  		$sel_order = $_POST['UnAssignOrder'];
	  		echo "<p><legend> Order Information: </legend></p>";
	  		$owner->ViewSelectOrder($sel_order);
	  		
	  	}
	  	else if(isset($_POST['Assign']))
	  	{
	  		$assignTo = $_POST['EMP'];
	  		$sel_order = $_POST['UnAssignOrder'];
	  		$owner->AssignOrder($assignTo,$sel_order);
	  		?>
	  		<script language="JavaScript">window.location.href="Orders.php"</script>
	  		<?php
	  	}
	  	echo "<p><legend> Employee: </legend></p>";
	  echo "<p>".$owner->GetallEmployee()."</p>";
	  ?>
	  <br>
	  <input type="submit" value="Assign" name="Assign"/>
	  <input type="submit" value="View Order Info" name="ViewOrder"/>
	  <input type="reset" value="Clear" name = "Clear" onclick="window.location.href='Jobs.php'"/>
	  </form>
	  </fieldset>
	</div>
	
<?php require_once 'footer.php';?>